import com.ssm.service.impl.CardServiceImpl;

import java.rmi.RemoteException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

public class Testtime{
    public static void  time() throws ParseException {
        long daySpan = 24 * 60 * 60 * 1000;
        final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd '9:34:30'");
        Date startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(sdf.format(new Date()));
        if(System.currentTimeMillis() > startTime.getTime())
            startTime = new Date(startTime.getTime() + daySpan);

        Timer t = new Timer();

        TimerTask task = new TimerTask(){
            @Override
            public void run() {
                // 要执行的代码
                System.err.println("dddddd");
            }
        };
        t.scheduleAtFixedRate(task, startTime, daySpan);
    }


    public static void main(String[] args) throws  ParseException {
//        CardServiceImpl service=new CardServiceImpl();
//        service.CardData();
//        System.out.println(service.CardData());
        time();
    }
}
